public class Solution {
    public void moveZeroes(int[] nums) {
        int length = nums.length;
        for(int i = 0, j = 0; i < length; i++) {
            if(nums[i] != 0) {
                nums[i - j] = nums[i];
                if(j != 0) {
                    nums[i]=0;
                }
            } else {
                j++;
            }
        }
    }
}